#ifndef GITLBLOCKEVTDISPATCHER_H
#define GITLBLOCKEVTDISPATCHER_H


#include <QThread>
#include <QMutex>
#include <QWaitCondition>
#include <QList>
#include "gitlmodual.h"
#include "gitlevent.h"
#include "gitldef.h"

class GitlBlockEvtDispatcher : public QThread
{
public:
    GitlBlockEvtDispatcher(QList<GitlModual*>* pcModuals);
    ~GitlBlockEvtDispatcher();
    /*! blocking notification
      */
    void postEvent(GitlEvent* pcEvt);

protected:
    /*!
     * \brief scan the event queue and deal with the event
     */
    virtual void run();


    ADD_CLASS_FIELD(int, iMaxEvtInQue, getMaxEvtInQue, setMaxEvtInQue)
    ADD_CLASS_FIELD_PRIVATE( QList<GitlEvent>, cEventQueue )
    ADD_CLASS_FIELD_PRIVATE( QMutex, cEvtQueLocker )
    ADD_CLASS_FIELD_PRIVATE( QWaitCondition, cEvtQueNotEmpty )
    ADD_CLASS_FIELD_PRIVATE( QWaitCondition, cEvtQueNotFull )
    ADD_CLASS_FIELD_PRIVATE( QList<GitlModual*>*, pcModuals )
};

#endif // GITLBLOCKEVTDISPATCHER_H
